/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kungkhies.persistence.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author clayton
 */
@Entity 
@Table(name = "assessment_url")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "AssessmentUrl.findAll", query = "SELECT a FROM AssessmentUrl a"),
    @NamedQuery(name = "AssessmentUrl.findByAssessmentUrlId", query = "SELECT a FROM AssessmentUrl a WHERE a.assessmentUrlId = :assessmentUrlId"),
    @NamedQuery(name = "AssessmentUrl.findByUrl", query = "SELECT a FROM AssessmentUrl a WHERE a.url = :url")
})
public class AssessmentUrl implements Serializable 
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "assessment_url_id")
    private Long assessmentUrlId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2083)
    @Column(name = "url")
    private String url;
    @JoinColumn(name = "assessment_id", referencedColumnName = "assessment_id")
    @ManyToOne(optional = false)
    private Assessment assessmentId;

    public AssessmentUrl()
    {
    }

    public AssessmentUrl(Long assessmentUrlId)
    {
        this.assessmentUrlId = assessmentUrlId;
    }

    public AssessmentUrl(Long assessmentUrlId, String url)
    {
        this.assessmentUrlId = assessmentUrlId;
        this.url = url;
    }

    public Long getAssessmentUrlId()
    {
        return assessmentUrlId;
    }

    public void setAssessmentUrlId(Long assessmentUrlId)
    {
        this.assessmentUrlId = assessmentUrlId;
    }

    public String getUrl()
    {
        return url;
    }

    public void setUrl(String url)
    {
        this.url = url;
    }

    public Assessment getAssessmentId()
    {
        return assessmentId;
    }

    public void setAssessmentId(Assessment assessmentId)
    {
        this.assessmentId = assessmentId;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (assessmentUrlId != null ? assessmentUrlId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AssessmentUrl))
        {
            return false;
        }
        AssessmentUrl other = (AssessmentUrl) object;
        if ((this.assessmentUrlId == null && other.assessmentUrlId != null) || (this.assessmentUrlId != null && !this.assessmentUrlId.equals(other.assessmentUrlId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.kungkhies.persistence.entities.AssessmentUrl[ assessmentUrlId=" + assessmentUrlId + " ]";
    }

}
